//
//  GMKnowlegeVC.m
//  Teecloud
//
//  Created by 小熊 on 2018/10/18.
//  Copyright © 2018年 小志. All rights reserved.
//

#import "GMKnowlegeVC.h"
#import "GMKnowlegeCell.h"
#import "GMDirsModel.h"
@interface GMKnowlegeVC ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong) UITableView *tabView;

@end

@implementation GMKnowlegeVC

- (void)viewDidLoad {
    [super viewDidLoad];
     self.title = @"知识点";
     self.view.backgroundColor = kWhiteColor;
    [self.tabView registerNib:[UINib nibWithNibName:@"GMKnowlegeCell" bundle:nil] forCellReuseIdentifier:@"GMKnowlegeCell"];
    if (self.dataArr.count == 0) {
        [self.tabView setupEmptyDataText:@"暂无数据" secoundText:@"" buttonTit:@"" verticalOffset:0 emptyImage:NODATAIMG tapBlock:^{
            
        } butClick:^{
            
        }];
    }
}
-(UITableView *)tabView{
    if (!_tabView) {
        _tabView = [UITableView zj_tableViewWithSuperview:self.view delegate:self style:UITableViewStylePlain constraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.view);
        }];
    }
    return _tabView;
}
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    GMKnowlegeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GMKnowlegeCell" forIndexPath:indexPath];
    GMDirsModel *dirModel = self.dataArr[indexPath.row];
    cell.model = dirModel;
    return cell;
}

- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return  self.dataArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    GMDirsModel *dirModel = self.dataArr[indexPath.row];
    NSDictionary *dict = @{
                           @"playTime":dirModel.StartPos,
                           @"endTime":dirModel.EndPos
                           };
    [[NSNotificationCenter defaultCenter] postNotificationName:@"playWithTheTime" object:dict];
}
@end
